Change in openvpn[master]: test_buffer: Add test for buf_null_terminate
A message that is not in the archive (sent off-list or not yet received): gerrit.1773842036000.I01683153a68e1809a4d7ab455eb346f53780e219@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email
to review the following change.
Change subject: test_buffer: Add test for buf_null_terminate
......................................................................
test_buffer: Add test for buf_null_terminate
---
M tests/unit_tests/openvpn/test_buffer.c
1 file changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/80/1580/1
tests/unit_tests/openvpn/test_buffer.c +27 -0
@@ -460,6 +460,32 @@gc_free (&gc); } +void +test_buffer_null_terminate (void **state) +{ +struct gc_arena gc =gc_new (); + +struct buffer buf =alloc_buf_gc (5 , &gc); +const char test1[] ="1234" ; +const char test2[] ="12345" ; +assert_true (buf_write (&buf, test1,sizeof (test1))); +assert_string_equal (BSTR (&buf),"1234" ); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +assert_true (buf_inc_len (&buf,-1 )); +assert_true (buf_write_u8 (&buf,'5' )); +assert_memory_equal (BPTR (&buf), test2,strlen (test2)); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +struct buffer buf2; +CLEAR (buf2); +buf_null_terminate (&buf2); + +gc_free (&gc); +} +/* for building long texts */ #define A_TIMES_256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO"
@@ -540,6 +566,7 @@cmocka_unit_test (test_snprintf),cmocka_unit_test (test_checked_snprintf),cmocka_unit_test (test_buffer_chomp), +cmocka_unit_test (test_buffer_null_terminate), cmocka_unit_test(test_buffer_parse) };
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I01683153a68e1809a4d7ab455eb346f53780e219
Gerrit-Change-Number: 1580
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email )
Change subject: test_buffer: Add test for buf_null_terminate
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I01683153a68e1809a4d7ab455eb346f53780e219
Gerrit-Change-Number: 1580
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 07 Apr 2026 09:50:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 test_buffer: Add test for buf_null_terminate
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1580
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1580
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
tests/unit_tests/openvpn/test_buffer.c +27 -0
@@ -460,6 +460,32 @@gc_free (&gc); } +void +test_buffer_null_terminate (void **state) +{ +struct gc_arena gc =gc_new (); + +struct buffer buf =alloc_buf_gc (5 , &gc); +const char test1[] ="1234" ; +const char test2[] ="12345" ; +assert_true (buf_write (&buf, test1,sizeof (test1))); +assert_string_equal (BSTR (&buf),"1234" ); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +assert_true (buf_inc_len (&buf,-1 )); +assert_true (buf_write_u8 (&buf,'5' )); +assert_memory_equal (BPTR (&buf), test2,strlen (test2)); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +struct buffer buf2; +CLEAR (buf2); +buf_null_terminate (&buf2); + +gc_free (&gc); +} +/* for building long texts */ #define A_TIMES_256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO"
@@ -540,6 +566,7 @@cmocka_unit_test (test_snprintf),cmocka_unit_test (test_checked_snprintf),cmocka_unit_test (test_buffer_chomp), +cmocka_unit_test (test_buffer_null_terminate), cmocka_unit_test(test_buffer_parse) };
[Openvpn-devel] [PATCH applied] Re: test_buffer: Add test for buf_null_terminate
This is easy - it adds a test instance to one of the pre-existing unit tests, the test works
[ RUN ] test_buffer_null_terminate
[ OK ] test_buffer_null_terminate
.. and it does so on all the instances in buildbot. In it goes...
Your patch has been applied to the master branch.
commit 798884d6df200c95b2c22de31860f3e35be617f7
Author: Frank Lichtenheld Date: Tue Apr 7 11:50:38 2026 +0200
test_buffer: Add test for buf_null_terminate
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1580
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36532.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: test_buffer: Add test for buf_null_terminate
......................................................................
test_buffer: Add test for buf_null_terminate
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1580
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36532.html
---
M tests/unit_tests/openvpn/test_buffer.c
1 file changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/80/1580/2
tests/unit_tests/openvpn/test_buffer.c +27 -0
@@ -460,6 +460,32 @@gc_free (&gc); } +void +test_buffer_null_terminate (void **state) +{ +struct gc_arena gc =gc_new (); + +struct buffer buf =alloc_buf_gc (5 , &gc); +const char test1[] ="1234" ; +const char test2[] ="12345" ; +assert_true (buf_write (&buf, test1,sizeof (test1))); +assert_string_equal (BSTR (&buf),"1234" ); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +assert_true (buf_inc_len (&buf,-1 )); +assert_true (buf_write_u8 (&buf,'5' )); +assert_memory_equal (BPTR (&buf), test2,strlen (test2)); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +struct buffer buf2; +CLEAR (buf2); +buf_null_terminate (&buf2); + +gc_free (&gc); +} +/* for building long texts */ #define A_TIMES_256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO"
@@ -540,6 +566,7 @@cmocka_unit_test (test_snprintf),cmocka_unit_test (test_checked_snprintf),cmocka_unit_test (test_buffer_chomp), +cmocka_unit_test (test_buffer_null_terminate), cmocka_unit_test(test_buffer_parse) };
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I01683153a68e1809a4d7ab455eb346f53780e219
Gerrit-Change-Number: 1580
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email )
Change subject: test_buffer: Add test for buf_null_terminate
......................................................................
test_buffer: Add test for buf_null_terminate
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1580
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36532.html
---
M tests/unit_tests/openvpn/test_buffer.c
1 file changed, 27 insertions(+), 0 deletions(-)
tests/unit_tests/openvpn/test_buffer.c +27 -0
@@ -460,6 +460,32 @@gc_free (&gc); } +void +test_buffer_null_terminate (void **state) +{ +struct gc_arena gc =gc_new (); + +struct buffer buf =alloc_buf_gc (5 , &gc); +const char test1[] ="1234" ; +const char test2[] ="12345" ; +assert_true (buf_write (&buf, test1,sizeof (test1))); +assert_string_equal (BSTR (&buf),"1234" ); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +assert_true (buf_inc_len (&buf,-1 )); +assert_true (buf_write_u8 (&buf,'5' )); +assert_memory_equal (BPTR (&buf), test2,strlen (test2)); +buf_null_terminate (&buf); +assert_string_equal (BSTR (&buf),"1234" ); + +struct buffer buf2; +CLEAR (buf2); +buf_null_terminate (&buf2); + +gc_free (&gc); +} +/* for building long texts */ #define A_TIMES_256 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO"
@@ -540,6 +566,7 @@cmocka_unit_test (test_snprintf),cmocka_unit_test (test_checked_snprintf),cmocka_unit_test (test_buffer_chomp), +cmocka_unit_test (test_buffer_null_terminate), cmocka_unit_test(test_buffer_parse) };
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1580?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I01683153a68e1809a4d7ab455eb346f53780e219
Gerrit-Change-Number: 1580
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>